package com.enqualcomm.kids.activities;

import android.content.Intent;
import android.os.Build;
import android.view.WindowManager;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.enqualcomm.kids.R;
import com.enqualcomm.kids.base.BaseActivity;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;

import common.utils.MyLogger;

/**
 * Created by Sunzhigang on 2016/3/11.
 */
@EActivity(R.layout.activity_aqiplay)
public class AQYPlayActivity extends BaseActivity{
    @ViewById(R.id.webview)
    WebView webView;

    @AfterViews
    void setupView(){
        Intent intent = getIntent();
        String url = intent.getStringExtra("url");
        if (url != null){
            webView.loadUrl(url);
            WebSettings webSettings = webView.getSettings();//获取WebView的配置实例
            webSettings.setJavaScriptEnabled(true);//支持JavaScript

            webView.setWebViewClient(new WebViewClient() {
                @Override
                public boolean shouldOverrideUrlLoading(WebView view, String url) {

                    view.loadUrl(url+"?apiKey=a813b5c475d74730b517748d713bab4");
                    return true;
                }


            });
        }
    }

    @Override
    protected void onDestroy() {
        webView.destroy();
        super.onDestroy();
    }
}
